-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: Improve embedded tweet performance #1345
Conversation
// Dynamically load the Twitter script after the component mounts | ||
const script = document.createElement('script'); | ||
script.src = 'https://platform.twitter.com/widgets.js'; | ||
script.async = true; | ||
document.body.appendChild(script); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Main update - loading the Twitter script once instead of 3 times.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should fix loading the widget javascript
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
||
useEffect(() => { | ||
const script = document.createElement('script'); | ||
script.src = 'https://platform.twitter.com/widgets.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only load the widget script once...was previously loading for each tweet
What changed? Why?
Notes to reviewers
How has it been tested?